/**
 * Date:2019年11月18日 下午3:18:49
 * Copyright (c) 2019, www.bwbroad.com All Rights Reserved
 */

package com.xue.common.log;

import org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Description: TODO <br/>
 * Date:2019年11月18日 下午3:18:49 <br/>
 * 
 * @author xuejianxin
 */
@Configuration
public class MyFilterConfig {

	@Bean(name = "tomcatAccessLogFilter")
	public TomcatAccessLogFilter sysVisitFilter() {
		return new TomcatAccessLogFilter();
	}

	@Bean
	public DelegatingFilterProxyRegistrationBean delegatingFilterProxyRegistrationBean() {
		DelegatingFilterProxyRegistrationBean bean = new DelegatingFilterProxyRegistrationBean("tomcatAccessLogFilter");
		bean.addInitParameter("targetFilterLifecycle", "true");
		bean.setEnabled(true);
		bean.addInitParameter("sessionUserKey", "username");
		bean.addInitParameter("maxPayloadLength", String.valueOf(500 * 3));
		bean.addUrlPatterns("/*");
		return bean;
	}

}
